package com.infovane.service.impl;

import java.util.List;

import com.infovane.dao.BaseDao;
import com.infovane.service.ArticleService;

public class ArticleServiceImpl implements ArticleService{
	
	
	private BaseDao baseDao;
	
	
	
	public BaseDao getBaseDao() {
		return baseDao;
	}

	public void setBaseDao(BaseDao baseDao) {
		this.baseDao = baseDao;
	}

	/**
	 * 分页获取文章数据
	 * @param first,count
	 * @return List
	 * */
	public List getArticleList(int currentPage, int pageSize) {
		String hql="from TArticle";
		return this.baseDao.load(hql, (currentPage-1)*pageSize, pageSize);
	}
	
	
	/**
	 * 获取数据库中文章数据记录数
	 * @return int
	 */
	public int getCount() {
		int count=0;
		String hql="select a.articleId from TArticle as a";
		List list=this.baseDao.load(hql);
		if(list.size()>0){
			count=list.size();	
		}
		return count;
	}

}
